Liberty Basic Sample Programs
I hope Carl will forgive me for stating, that although the excellent sample programs that come with LB are often an enormous help to all, nevertheless they can have their shortcomings for a complete novice to LB. Having been accustomed to trying various version of Basic for a number of years before trying LB, as a raw beginner I found one or two facets of LB very puzzling. In actual fact I was experimenting on and off with the earlier version 1.04 as Shareware for several months, if not a year, before I mastered some of the principles well enough to write a complete program. I then felt confident enough to 'splash out' for a registered version of 2.02. Meanwhile I had continue to doggedly produce all my efforts for DOS, by creating compiled EXE files using QuickBasic ( similar to Qbasic ).
Like others using Basic I was familiar with the concept of assigning a #handle to saving and loading files, but it took a long time for my simple mind to realize we need to use the same principle to open and close windows such as
open "Graphic Files Viewer" for graphics_fs_nsb as #v
and
close# v
The first point that I would like to make for the benefit of beginners, is that not all of the many sample programs close properly, because they do not contain the necessary close #handles and the ' end' statement. This is not of course a serious error, and should never cause any damage to your system. But in some cases when using complex API calls, it can temporarily upset the system. In which case I have always found the system will reset itself by just aborting LB and restarting LB, taking care of course to correct the error if possible.
The other point I would like to make, which caused me some frustration for some time, and discouraged me from trying LB for a while, is the fact that again many of the sample programs failed to contain the important nomainwin command. I could not understand why I needed to close the mainwindow, when I had closed say a graphics or text window. I was therefore reluctant to try to compile programs for others, if having to admit everyone would need to close the mainwindow manually, after the rest of the program has closed.
In fact the mainwindow can be extremely useful for anyone completely new to any form of Basic programming, because you can test simple routines without the need to understand any of the complexities associated with other windows. There are even a few commands which work in the mainwindow, that will not work in other window the same way, such as the input and locate commands below.
print "Enter message"
input message$
locate 10, 5
print message$;" printed at line 6 column 10"
end
However as has been stated many time before, is bad practice to do any serious LB programming only using the mainwindow, apart form simple demonstrations and tests, in view of the wealth of extra functions only available with other windows. For example you cannot produce multiple fonts or colours, or any graphics without the use of a graphics window. So beginners are strongly advised to start using other windows as soon as they are confident, and do not forget to insert nomainwin anywhere in your program, but preferable on the first line, by following normal procedure.
Happy programming to beginners. Gordon Sweet